<!DOCTYPE html>
<html lang="en">

	<!-- Mirrored from www.zi-han.net/theme/hplus/login_v2.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:49 GMT -->

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
		<title>运营管理后台</title>
		<link rel="shortcut icon" href="favicon.ico">
		<link href="css/bootstrap.min.css" rel="stylesheet">
		<link href="css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
		<link href="css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
		<link href="css/animate.min.css" rel="stylesheet">
		<link href="css/style.min.css" rel="stylesheet">
		<link href="css/login.min.css" rel="stylesheet">
		<!--[if lt IE 9]>
    	<script>
    		TipsAlert("请勿使用IE浏览器打开");
    	</script>
    <![endif]-->
		<style type="text/css">
			/*以下是等待状态的通用样式*/
			.wating_big_div {
				position: absolute;
				top: 0px;
				width: 100%;
				height: 100%;
				display: table;
				z-index: 9999;
			}
			
			.zhezhao {
				opacity: 0.3;
				position: absolute;
				top: 0px;
				width: 100%;
				height: 100%;
				z-index: 9999;
			}
			
			.wating_content_div {
				text-align: center;
				background: none;
				display: table-cell;
				vertical-align: middle;
			}
      /*以上是等待状态的通用样式*/
      
		</style>
	</head>

	<body class="signin h100p" style="display:flex;align-items: center;">
		<header class="w100p login_header hide">
			<div class="header_div tac">
				<!-- <img src="img/logo.png" /> -->
			</div>
    </header>
		<div class="signinpanel w100p h100p">
			<div class="row h100p login_table">
				<div class="login_tablebell">
					<div class="form_div">
						<!--method="post" action="http://www.zi-han.net/theme/hplus/index.html"-->
						<h4 class="no-margins tac f18">管理员账号登录</h4>
						<form id="login_form" method="post">
							<div class="pre h40 p010 mt25">
								<img src="img/user_icon.png" class="pull-left login_icon mt5" />
								<input type="text" name="username" class="form-control login_input c0 pull-left" placeholder="用户名" />
							</div>
							<div class="pre h40 p010 mt15">
								<img src="img/pw_icon.png" class="pull-left login_icon mt5" />
								<input type="password" name="password" class="form-control pwd_input pull-left c0" placeholder="密码" />
							</div>
							
							<div class="pre h40 p010 mt15">
								<div class="col-sm-4" style="padding-left:0;padding-right:0;">
									<img src="" class="verCanvas" />
								</div>
								<div class="col-sm-7 pull-right">
									<input type="text" name="validateCode"
										class="form-control verCanvas_input c0 pull-right" placeholder="请输入验证码"
										style="width:100%!important" />
								</div>
							</div>
							
							<div class="none">
								<input type="text" name="token" class="c0" id="login_token" />
							</div>
						</form>
						<button class="btn btn-success btn-block br8 h40 bdno">登录</button>
					</div>
				</div>
			</div>
		</div>
		
		<!--加载遮罩组件-->
		<div class="none" id="wating_show">
			<div class="ibox wating_big_div">
				<div class="zhezhao bg_f"></div>
				<div class="ibox-content wating_content_div ">
					<div class="spiner-example">
						<div class="sk-spinner sk-spinner-wave">
							<div class="sk-rect1"></div>
							<div class="sk-rect2"></div>
							<div class="sk-rect3"></div>
							<div class="sk-rect4"></div>
							<div class="sk-rect5"></div>
						</div>
						<h5 class="f20 c0">正在请求登录 ，请稍后...... (<span id="second_span">0</span>)秒</h5>
					</div>
				</div>
			</div>
		</div>
		<footer class="login_footer h50 w100p tac">
			<div class="" style="background-color: #03557A;height: 30px;margin-top: 20px;color: #fff;display: flex;">
				<div class="goToBeian" style="height: 30px;line-height: 30px;cursor: pointer;margin: 0 auto;">Copyright©2015-2020 &nbsp;&nbsp;粤ICP备20027914号-1</div>
			</div>
		</footer>
	</body>
	
	<script src="js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
  <script src="js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
  <script src="js/plugins/sweetalert/sweetalert.min.js"></script>
	<script src="js/common.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/md5.js" type="text/javascript" charset="utf-8"></script>
	<script>
		if(window.top !== window.self) {
			window.top.location = window.location
		};
		var timeout;
		$(document).ready(function() {
			var timestamp = Date.parse(new Date());
			
			// 获取验证码
			$('.verCanvas').attr('src', urls + common_url.loginVerifiCode + '?timestamp=' + timestamp);
			$('.verCanvas').on('click', function () {
				$(this).attr('src', '');
				timestamp = Date.parse(new Date());
				$('.verCanvas').attr('src', urls + common_url.loginVerifiCode + '?timestamp=' + timestamp);
			})
			
			if (sessionStorage.getItem("token")) {
				$.ajax({
					type:"post",
					url:urls + common_url.login,
					async:true,
					data:{token:sessionStorage.getItem("token")},
					success:function (json) {
						if (json.return_msg) {
							TipsAlert("您已经登录过了！即将为您跳转到首页");
							sessionStorage.setItem("user_message", JSON.stringify(json.result));
							window.location = "index.html?time=" + new Date().getTime().toString();
						}
					},
					error:function(xml, text, errorThrown) {
						if (text == "timeout") {
							TipsAlert("请求超时,请检查网络或着重新登陆");
						} else{
							TipsAlert("请求登陆登录");
						}
					}
				});
			}
			$(".btn-success").click(function() {
				Login();
			});
			
			$(".goToBeian").click(function(){
				window.open("http://beian.miit.gov.cn/");
			})
			
			$(window).keydown(function(event) {
				if(parseInt(event.keyCode) == 13) {
					Login();
				}
			});
		});
	
		function Login() {
			if($(".login_input").val().trim() == "") {
				TipsAlert("用户名不能为空");
				return false;
			}
			if($(".pwd_input").val().trim() == "") {
				TipsAlert("密码不能为空");
				return false;
			}
			if ($(".verCanvas_input").val().trim() == "") {
				TipsAlert("验证码不能为空");
				return false;
			}
			$("#wating_show").removeClass("none");
			timeout = setInterval("Timeout(timeout)", 1000);
			if (sessionStorage.getItem("token")) {
				$("#login_token").val(sessionStorage.getItem("token"));
			}
			// console.log(urls + common_url.login);
			
			var password = hex_md5($('.pwd_input').val());
			$.ajax({
				type: "post",
				url: urls + common_url.login,
				async: true,
				dataType: "json",
				data: {
					userName: $('.login_input').val(),
					password: password,
					validateCode: $('.verCanvas_input').val()
				},
				// data: $("#login_form").serialize(),
				timeout:30000,
				success: function(json) {
					console.log(json);
					if (json.msg == "成功") {
						console.log(json);
						$("#login_token").val(json.data.token);
						sessionStorage.setItem("token",json.data.token);
						sessionStorage.setItem("user_message", JSON.stringify(json.data));
						window.location = "index.html?time=" + new Date().getTime().toString();
						
					} else {
						TipsAlert(json.msg);
					}
					InitTime (timeout);
				},
				error: function(xml, text, errorThrown) {
					// console.log(text)
					if (text == "timeout") {
						TipsAlert("请求超时,请检查网络或着重新登陆");
					} else{
						TipsAlert("请求登录失败");
					}
					InitTime (timeout);
				}
			});
		}
	</script>
	